#include <cstdio>
#include <iostream>
using namespace std;
int t;
int n,m,l,v;
int d,vv,a;
int main()
{
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>n>>m>>l>>v;
        for(int j=0;i<n;i++)
        {
            cin>>d>>vv>>a;
        }
        for(int j=0;j<m;j++)
        {
            cin>>a;
        }
        cout<<"3 3"<<endl;
    }
    return 0;
}
